// David Ciani <dciani@ucsc.edu>
// $Id: Card.java 4 2011-03-08 11:27:57Z dciani@davidciani.com $
import java.util.*;

class Card {
    private int suit; // 0->Club 1->Diamonds 2->Hearts 4->Spades
    private int card; 
        
    public Card(int number) {
        this.suit = number / 13;
        this.card = number % 13 + 1;
    }

    public boolean isAce() {
        if(this.card == 1) return true;
        else return false;
    }

    public int getValue() {
        if (this.card == 1) return 11;
        else if (this.card > 10) return 10;
        else return this.card;
    }

    public String toString() {
        HashMap<Integer,String> suits = new HashMap<Integer,String>();
        suits.put(0,"Clubs");
        suits.put(1,"Diamonds");
        suits.put(2,"Hearts");
        suits.put(3,"Spades");

        HashMap<Integer,String> cards = new HashMap<Integer,String>();
        cards.put(1,"Ace");
        cards.put(2,"Two");
        cards.put(3,"Three");
        cards.put(4,"Four");
        cards.put(5,"Five");
        cards.put(6,"Six");
        cards.put(7,"Seven");
        cards.put(8,"Eight");
        cards.put(9,"Nine");
        cards.put(10,"Ten");
        cards.put(11,"Jack");
        cards.put(12,"Queen");
        cards.put(13,"King");

        return String.format("%5s of %-8s", cards.get(this.card), suits.get(this.suit));
    }

}
